//
//  WQNewFutureViewCell.m
//  sanwuWeiboOC
//
//  Created by 王先强 on 15/12/11.
//  Copyright © 2015年 王先强. All rights reserved.
//

#import "WQNewFutureViewCell.h"

@interface WQNewFutureViewCell ()

@property (nonatomic, strong) UIImageView *cellImageView;
@property (nonatomic, strong) UIButton *cellButton;

@end

@implementation WQNewFutureViewCell

-(UIButton *)cellButton{
    if (_cellButton == nil) {
        _cellButton = [[UIButton alloc] init];
        [_cellButton setBackgroundImage:[UIImage imageNamed:@"new_feature_finish_button"] forState:UIControlStateNormal];
        [_cellButton setBackgroundImage:[UIImage imageNamed:@"new_feature_finish_button_highlighted"] forState:UIControlStateHighlighted];
        [_cellButton setTitle:@"开始体验" forState:UIControlStateNormal];
        _cellButton.titleLabel.font = [UIFont systemFontOfSize:16];
        [_cellButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_cellButton addTarget:self action:@selector(start) forControlEvents:UIControlEventTouchUpInside];

    }
    return _cellButton;
}

-(UIImageView *)cellImageView{
    if (_cellImageView == nil) {
        _cellImageView = [[UIImageView alloc] init];
        _cellImageView.userInteractionEnabled = YES;
        
    }
    return _cellImageView;
}

-(void)setCellIndex:(NSInteger)cellIndex{
    _cellIndex = cellIndex;
    
    self.cellImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"new_feature_%ld",(long)cellIndex]];
    self.cellImageView.frame = self.bounds;
    [self addSubview:self.cellImageView];
    [self.cellImageView addSubview:self.cellButton];
    self.cellButton.hidden = YES;
    self.cellButton.width = 80;
    self.cellButton.height = 35;
    self.cellButton.centerX = self.cellImageView.centerX;
    self.cellButton.centerY = self.cellImageView.height * 0.75;
//    WQLog(@"%@",NSStringFromCGRect(self.cellButton.frame));
}

-(void)startAnimation{
    self.cellButton.hidden = NO;
    self.cellButton.transform = CGAffineTransformMakeScale(0, 0);
    [UIView animateWithDuration:0.4 animations:^{
        self.cellButton.transform = CGAffineTransformIdentity;
    }];
}

-(void)start{
    WQLog(@"start");
}
@end
